package cn.ffcs.uec.recordsApproval.component;

import java.util.ArrayList;
import java.util.List;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.zkoss.zk.ui.Components;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.IdSpace;
import org.zkoss.zul.Div;

import cn.ffcs.uec.recordsApproval.component.bean.OutStaffPsnjobEditApprovalViewExtBean;
import cn.ffcs.uom.common.util.ListboxUtils;
import cn.ffcs.uom.common.vo.NodeVo;
import lombok.Getter;

/**
 * 外包人员兼职流程弹框Ext
 * @author liuxiaodong
 *
 */
@Controller
@Scope("prototype")
public class OutStaffPsnjobEditApprovalViewExt extends Div implements IdSpace {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1972187764160669116L;
	
	@Getter
	private OutStaffPsnjobEditApprovalViewExtBean bean = new OutStaffPsnjobEditApprovalViewExtBean();
	
	public static final String OUT_STAFF_PSNJOB_EDIT_APPROVAL_VIEW_EXT_ZUL = 
			"/pages_nmg/recordsApproval/comp/outStaff_psnjob_edit_approval_view_ext.zul";


	/**
	 * 构造函数
	 */
	public OutStaffPsnjobEditApprovalViewExt() {
		Executions.createComponents(OUT_STAFF_PSNJOB_EDIT_APPROVAL_VIEW_EXT_ZUL, this, null);
		Components.wireVariables(this, bean);
		Components.addForwards(this, this, '$');
		
	}

	/**
	 * 初始化
	 */
	public void onCreate() {
		this.bindCombobox();



		
		
	}
	
	/**
	 * 绑定combobox
	 */
	private void bindCombobox() {
		// 是否试用trialFlag
		List<NodeVo> nodeVoList = new ArrayList<NodeVo>();
		String[][] trialFlag = { { "Y", "是" }, { "N", "否" } };
		for (int i = 0; i < trialFlag.length; i++) {
			NodeVo nodeVo = new NodeVo();
			for (int j = 0; j < 1; j++) {
				nodeVo.setId(trialFlag[i][j]);
				nodeVo.setName(trialFlag[i][j + 1]);
			}
			nodeVoList.add(nodeVo);
		}
		ListboxUtils.rendererForEdit(bean.getTrialFlag(), nodeVoList);
		// 人员状态
		ListboxUtils.rendererForEdit(bean.getGlbdef1(), nodeVoList);
		// 是否主职
		ListboxUtils.rendererForEdit(bean.getIsmainjob(), nodeVoList);
		// 是否在岗
		ListboxUtils.rendererForEdit(bean.getPoststat(), nodeVoList);
		//是否结束
		ListboxUtils.rendererForEdit(bean.getEndflag(), nodeVoList);

		// 人员状态jobglbdef1
		List<NodeVo> nodeVoStatusList = new ArrayList<NodeVo>();
		String[][] jobglbdef1 = { { "1001A110000000000681", "在岗" },
				{ "1001A110000000000682", "一般在岗" },
				{ "1001A110000000000683", "交流" },
				{ "1001A110000000000684", "挂职锻炼" },
				{ "1001A110000000000685", "借调" },
				{ "1001A110000000000686", "扶贫" },
				{ "1001A110000000000687", "援藏" },
				{ "1001A110000000000688", "接收交流" },
				{ "1001A110000000000689", "接收挂职" },
				{ "1001A11000000000068A", "接收借调" },
				{ "1001A11000000000068B", "接收援藏（西藏省用）" },
				{ "1001A11000000000068C", "试用见习人员" },
				{ "1001A11000000000068D", "不在岗" },
				{ "1001A11000000000068E", "待岗" },
				{ "1001A11000000000068F", "派往海外" },
				{ "1001A11000000000068G", "派往控股参股公司" },
				{ "1001A11000000000068H", "派往实业公司" },
				{ "1001A11000000000068I", "派往集团外" },
				{ "1001A11000000000068J", "长病假" },
				{ "1001A11000000000068K", "长期学习" },
				{ "1001A11000000000068L", "其他" },
				{ "1001A11000000000068M", "无岗位" } };
		for (int i = 0; i < jobglbdef1.length; i++) {
			NodeVo nodeVo = new NodeVo();
			for (int j = 0; j < 1; j++) {
				nodeVo.setId(jobglbdef1[i][j]);
				nodeVo.setName(jobglbdef1[i][j + 1]);
			}
			nodeVoStatusList.add(nodeVo);
		}
		ListboxUtils.rendererForEdit(bean.getJobglbdef1(), nodeVoStatusList);

		// 人员类型psntype
		List<NodeVo> nodeVoPsntypeList = new ArrayList<NodeVo>();
		String[][] psntype = { { "0", "新进" }, { "1", "变更" }, { "2", "退出" } };
		for (int i = 0; i < psntype.length; i++) {
			NodeVo nodeVo = new NodeVo();
			for (int j = 0; j < 1; j++) {
				nodeVo.setId(psntype[i][j]);
				nodeVo.setName(psntype[i][j + 1]);
			}
			nodeVoPsntypeList.add(nodeVo);
		}
		ListboxUtils.rendererForEdit(bean.getPsntype(), nodeVoPsntypeList);
		// 任职类型psnjobtype
		List<NodeVo> nodeVoPkJobtypeList = new ArrayList<NodeVo>();
		String[][] pkjobtype = { { "1001A1100000005ZZ013", " 主职" },{ "1001Z710000000006O00", " 兼职" }  };
		for (int i = 0; i < pkjobtype.length; i++) {
			NodeVo nodeVo = new NodeVo();
			for (int j = 0; j < 1; j++) {
				nodeVo.setId(pkjobtype[i][j]);
				nodeVo.setName(pkjobtype[i][j + 1]);
			}
			nodeVoPkJobtypeList.add(nodeVo);
		}
		ListboxUtils.rendererForEdit(bean.getPkJobType(), nodeVoPkJobtypeList);

		// 进入本单位来源jobglbdef10
		List<NodeVo> nodeVoJobglbdef10List = new ArrayList<NodeVo>();
		String[][] jobglbdef10 = { { "1001A1100000000005Z0", "系统外部进入" },
				{ "1001A1100000000005Z1", "应届毕业生" },
				{ "1001A1100000000005Z2", "社会招聘-从派制中招聘" },
				{ "1001A1100000000005Z3", "社会招聘-从外包中招聘" },
				{ "1001A1100000000005Z4", "社会招聘-其他" },
				{ "1001A1100000000005Z5", "政策性接收-复退军人" },
				{ "1001A1100000000005Z6", "政策性接收-转业军人" },
				{ "1001A1100000000005Z7", "政策性接收-其它" },
				{ "1001A1100000000005Z8", "从外单位调入" },
				{ "1001A1100000000005Z9", "成建制划入-联通划转" } };
		for (int i = 0; i < jobglbdef10.length; i++) {
			NodeVo nodeVo = new NodeVo();
			for (int j = 0; j < 1; j++) {
				nodeVo.setId(jobglbdef10[i][j]);
				nodeVo.setName(jobglbdef10[i][j + 1]);
			}
			nodeVoJobglbdef10List.add(nodeVo);
		}
		ListboxUtils.rendererForEdit(bean.getJobglbdef10(),
				nodeVoJobglbdef10List);

		// 岗位工资档次-
		List<NodeVo> nodeVoJobglbdef9List = new ArrayList<NodeVo>();
		String[][] jobglbdef9 = { { "1001A1100000000005KV", "A档" },
				{ "1001A1100000000005KW", "B档" },
				{ "1001A1100000000005KX", "C档" },
				{ "1001A1100000000005KY", "D档" },
				{ "1001A1100000000005KZ", "E档" },
				{ "1001A1100000000005L0", "F档" },
				{ "1001A1100000000005L1", "A档" },
				{ "1001A1100000000005L2", "B档" },
				{ "1001A1100000000005L3", "C档" },
				{ "1001A1100000000005L4", "D档" },
				{ "1001A1100000000005L5", "E档" },
				{ "1001A1100000000005L6", "F档" },
				{ "1001A1100000000005L7", "G档" },
				{ "1001A1100000000005L8", "H档" },
				{ "1001A1100000000005L9", "I档" },
				{ "1001A1100000000005LA", "J档" } };
		for (int i = 0; i < jobglbdef9.length; i++) {
			NodeVo nodeVo = new NodeVo();
			for (int j = 0; j < 1; j++) {
				nodeVo.setId(jobglbdef9[i][j]);
				nodeVo.setName(jobglbdef9[i][j + 1]);
			}
			nodeVoJobglbdef9List.add(nodeVo);
		}
		ListboxUtils
				.rendererForEdit(bean.getJobglbdef9(), nodeVoJobglbdef9List);

		// 试用类型
		// 人员类型trialType
		List<NodeVo> nodeVoTrialTypeList = new ArrayList<NodeVo>();
		String[][] trialType = { { "1", "入职试用" }, { "2", "转岗试用" } };
		for (int i = 0; i < trialType.length; i++) {
			NodeVo nodeVo = new NodeVo();
			for (int j = 0; j < 1; j++) {
				nodeVo.setId(trialType[i][j]);
				nodeVo.setName(trialType[i][j + 1]);
			}
			nodeVoTrialTypeList.add(nodeVo);
		}
		ListboxUtils.rendererForEdit(bean.getTrialType(), nodeVoTrialTypeList);

	}

}
